home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / CIncludes / time.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-05  |  2.2 KB  |  100 lines  |  [TEXT/MPS ]

  1. /************************************************************
  2.  
  3.     Time.h
  4.     Date and time
  5.     
  6.     Copyright © Apple Computer,Inc.  1987-1991, 1993, 1994.
  7.     All Rights Reserved.
  8.  
  9. ************************************************************/
  10.  
  11. /* Conditional Macros:
  12.  *    UsingStaticLibs    - for CFM-68K:  Insures that #pragma import is never used.
  13.  *    <none>            - for CFM-68K:    Insures that all functions and data items are
  14.  *                                    marked as library imports
  15.  */
  16.  
  17.  
  18. #ifndef __TIME_H__ /* __TIME__ is a reserved preprocessor symbol */
  19. #define __TIME_H__
  20.  
  21.  
  22. /*
  23.  * Get common declarations 
  24.  */
  25.  
  26. #include <NullDef.h>
  27. #include <SizeTDef.h>
  28.  
  29. /*
  30.  *    Declarations
  31.  */
  32.  
  33. #define CLOCKS_PER_SEC 60
  34. typedef unsigned long int clock_t;
  35. typedef unsigned long int time_t;
  36. #ifdef powerc
  37. #pragma options align=power
  38. #endif
  39. struct tm {
  40.     int tm_sec;        /* Seconds after the minute -- [0, 61] */
  41.     int tm_min;        /* Minutes after the hour -- [0, 59] */
  42.     int tm_hour;    /* Hours after midnight -- [0, 23] */
  43.     int tm_mday;    /* Day of the month -- [1, 31] */
  44.     int tm_mon;        /* Months since January -- [0, 11] */
  45.     int tm_year;    /* Years since 1900 */
  46.     int tm_wday;    /* Days since Sunday -- [0, 6] */
  47.     int tm_yday;    /* Days since January 1 -- [0, 365] */
  48.     int tm_isdst;    /* Daylight Savings Time flag */
  49. };
  50. #ifdef powerc
  51. #pragma options align=reset
  52. #endif
  53.  
  54. #ifdef __cplusplus
  55. extern "C" {
  56. #endif
  57.  
  58. #if defined (__CFM68K__) && !defined (UsingStaticLibs)
  59.     #pragma import on
  60. #endif
  61.  
  62. /*
  63.  *    Time manipulation functions
  64.  */
  65.  
  66. clock_t clock(void);                        /* function */
  67. #ifndef powerc
  68.     #define clock() __tickcount()            /* macro - use TickCount() */
  69.     pascal unsigned long __tickcount(void)
  70.         = 0xA975; 
  71. #endif /* powerc */
  72.  
  73. double  difftime(time_t time1, time_t time0);                /* function */
  74. #define difftime(time1,time0) ((long double)time1 - time0)    /* macro */
  75.  
  76. time_t mktime(struct tm *timeptr);
  77. time_t time(time_t *timer);
  78.  
  79.  
  80. /*
  81.  *    Time conversion functions
  82.  */
  83.  
  84. char *asctime (const struct tm *timeptr);
  85. char *ctime(const time_t *timer);
  86. struct tm *gmtime(const time_t *timer);
  87. struct tm *localtime(const time_t *timer);
  88. size_t strftime(char *s, size_t maxsize,
  89.                  const char *format, const struct tm *timerptr);
  90.  
  91. #if defined (__CFM68K__) && !defined (UsingStaticLibs)
  92.     #pragma import off
  93. #endif
  94.  
  95. #ifdef __cplusplus
  96. }
  97. #endif
  98.  
  99. #endif
  100.